package com.learn.container_interface;

import com.learn.container_interface.beans.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ApplicationContextMain {
    public static void main(String[] args) {
        // 1.创建BeanFactory、创建读取器、加载配置文件
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("container-interface.xml");
        
        // 2.通过id获取Bean实例
        UserService userService = applicationContext.getBean("userService", UserService.class);
        System.out.println(userService);
        
        /*
         * setUserDao：com.learn.ContainerInterface.beans.dao.UserDaoImpl@6dc17b83
         * com.learn.ContainerInterface.beans.service.UserServiceImpl@57a3af25
         */
    }
}
